#ifndef _INAPP_PURCHASE_MANAGER_H_
#define _INAPP_PURCHASE_MANAGER_H_

#include <string>

class InAppPurchaseHandler
{
public:
    virtual void    OnPurchaseSuccess() = 0;
    virtual void    OnPurchaseFail() = 0;
    
    
};

class InAppPurchaseManager
{
public:
    
    
    
	static InAppPurchaseManager&           Instance();
    
    
    
    
    void                                    LoadStore(const std::string& ProductName,
                                                      InAppPurchaseHandler* pHandler
                                                      );
	void									SetHandler(InAppPurchaseHandler* pHandler) { m_pHandler = pHandler; };

    bool                                    CanMakePurchases();
    void                                    PurchaseProUpgrade(const std::string& ProdcutnName);
    bool                                    IsFinishPurchasing();
    bool                                    IsSuccessurchasing();
    void                                    OnSuccess();
    void                                    OnFail();     
    void                                    OnCompleteLoadingStore(); 
    void                                    RestorePurchase();
   
protected:
    
	InAppPurchaseManager() : m_pHandler(NULL),
                             m_IsFinish(false),
                             m_IsSuccess(false),
                             m_IsWaitingForLoadingStore(false)
    {};
	
    
    InAppPurchaseHandler*                   m_pHandler;
    bool                                    m_IsFinish;
    bool                                    m_IsSuccess;
    bool                                    m_IsWaitingForLoadingStore;
    
    
    
    
};

#endif